package com.ja.openchat.ui.chat;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.ja.openchat.R;
import com.ja.openchat.ui.chat.adapter.MessageReactionUserAdapter;
import com.lxj.xpopup.core.BottomPopupView;
import com.lxj.xpopup.util.XPopupUtils;
import com.zy.openchat.core.model.message.MessageReaction;

import java.util.List;

public class MessageReactionUserDialog extends BottomPopupView {

    private List<MessageReaction> messageReactions;

    public MessageReactionUserDialog(@NonNull Context context, List<MessageReaction> messageReactions) {
        super(context);
        this.messageReactions = messageReactions;
    }

    private RecyclerView recyclerView;
    @Override
    protected void onCreate() {
        super.onCreate();
        recyclerView = findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        findViewById(R.id.close_btn).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });
        recyclerView.setAdapter(new MessageReactionUserAdapter(messageReactions));
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_message_reaction_users;
    }

    @Override
    protected int getMaxHeight() {
        return (int) (XPopupUtils.getAppHeight(getContext())*.7f);
    }

}
